Release 10.1A: OpenEdge Development:
Java Open Clients
Passing a ProDataGraph as OUTPUT
To pass a ProDataGraph as output, you create a ProDataGraphHolder instance to contain the ProDataGraph, and pass the holder as the proxy method parameter that maps to the application service DATASET or DATASET-HANDLE OUTPUT parameter. You do not need to create an initial ProDataGraph object to instantiate the ProDataGraphHolder instance. The Java Open Client interface creates the ProDataGraph required to hold the data returned from the corresponding output ProDataSet on the AppServer.
![]()
To return an output ProDataGraph, get the value of the getProDataGraphValue() method invoked on the output ProDataGraphHolder parameter.
The actual value and content of the output ProDataGraph can vary depending on how the ProDataSet is defined by the application service. For example, if the OUTPUT ProDataSet is passed as a DATASET-HANDLE (dynamically), this value can be null. A null value indicates that the DATASET-HANDLE parameter was set to the Unknown value (
?) or undefined (defined with no schema and data) by the application service. A dynamic ProDataSet might also be passed without data-relations created for it, and so on.Once you have the output ProDataGraph, you can access its data, depending on whether you already know the schema of the corresponding ProDataSet.
Accessing a ProDataGraph with a known schema
If you already know the schema of the ProDataSet, you can use this information to access the data in the ProDataGraph. If you do not know the schema, see the "Accessing the ProDataGraph meta data" section.
![]()
To access the data in a ProDataGraph:
- Return the ProDataObject list from the ProDataGraph that maps to a specified temp-table using the following ProDataGraph method, where
tableNameis the 4GL name of the temp-table:
- Iterate through the ProDataObject list returned in Step 1 and locate a ProDataObject instance that contains data that you want.
Note: For more information on determining the- Use the appropriate ProDataObject property access methods to return the values of specified column properties of the
ProDataObjectfound in Step 2, wherepropertyIndexis the index into theProDataObjectcolumn property list, andnameis the 4GL name of the temp-table field that the property maps to.propertyIndexof a column property and other information about column properties of aProDataObject, see the "Using Java SDO classes to access Property meta data" section.Note: You can check that a column Property is many-valued, and therefore returns a List, by testing the value returned by its isMany() method.
- To return the value of a specified single-valued column property in the form of the Property data type, use one of these ProDataObject methods, where
DataTypeis the full Java classname or intrinsic type name of the property data type andDataTypeNameis a name that closely matches the name of the data type that the method returns:
To identify the Java intrinsic data type or class of the column property that maps to the 4GL data type of the temp-table field, see Table 5–3. For example, the following two methods return values for an int property (mapped to an
INTEGERfield) and a BigDecimal property (mapped to aDECIMALfield):
- To return the value of a specified many-valued property (which maps to a temp-table array field), use one of these ProDataObject methods:
The objects in the List all have the data type of the column Property.
- If you need to access parent or child relations of the ProDataObject that you access in Step 3, you can use the following methods:
- To return a list of child rows for the specified
ProDataObject, use thisProDataObjectmethod:
The method returns a list of child rows (ProDataObject instances) for this parent
ProDataObjectaccording to the data-relation specified by name (relationName). Iterate through the list to locate aProDataObjectthat you want to access.- To return a parent row for the specified
ProDataObject, use thisProDataObjectmethod:
The method returns a parent ProDataObject for this child
Note: For aProDataObjectaccording to the data-relation specified by name (relationName).ProDataGraph, therelationNameidentifies aDATA-RELATIONdefined in the corresponding ProDataSet parameter of the application service, and this name is identical to the 4GL name of the specifiedDATA-RELATION.Once you have a child or parent
ProDataObject, you can continue with Step 3 to access its data.For more information on
ProDataObjectmethods, see the "ProDataObject class" section.Accessing the ProDataGraph meta data
You might not know any or all of the schema for an output
ProDataGraph. In this case, you can introspect theProDataGraphto identify all of its meta data, including the names and locations of allProDataGraphcomponents that map to the corresponding ProDataSetOUTPUTparameter. These components can include only the functional Java components of theProDataGraphor they can also include the names, locations, and data types of the ProDataSet, its temp-tables, fields, and data-relations, as you might require.You can get meta data for an unknown
ProDataGraphin different ways. The following procedure shows one approach for accessingProDataGraph, primarily by identifying and using component names. You can also identify component locations and use indexes (rather than names) to more directly and efficiently access components.
![]()
To access the meta data of a ProDataGraph:
- If you need the 4GL name of the ProDataSet that the
ProDataGraphmaps to, use thisProDataGraphmethod:
- To get 4GL schema information for temp-tables or get information on data-relations that have been passed in the ProDataGraph, get its associated ProDataGraphMetaData object using this ProDataGraph method:
- To get 4GL schema information for each temp-table passed in the ProDataGraph:
- Get the 4GL names for all ProDataSet temp-tables (
ProDataObjectcollections) in theProDataGraphusing thisProDataGraphMetaDatamethod:
- Get the ProDataObjectMetaData for a temp-table using this ProDataGraphMetaData method, where the
idxvalue corresponds to the index into the list of table names that refers to the name of the given temp-table:
- Some useful schema information you can get from this meta data for an output temp-table is the field name, the Progress 4GL data type, any extent (for an array), and the specified user order of each temp-table field using these ProDataObjectMetaData methods:
The
propertyIndexis a 0-based value that you can obtain by looping through the number of temp-table fields returned by thisProDataObjectMetaDatamethod:
This value is also identical to the index into the corresponding ProDataObject property list that references the corresponding column property (see "Using Java SDO classes to access Property meta data" section).
For more information on ProDataObjectMetaData methods, see the "ProDataObjectMetaData class" section.
- To get the meta data for data-relations passed in the ProDataGraph:
- Get the number of
ProDataRelationMetaDataobjects in theProDataGraphusing thisProDataGraphMetaDatamethod:
- Get each ProDataRelationMetaData object associated with the ProDataGraph using this ProDataGraphMetaData method, where
idxstarts at 0 for the number of data-relations in the ProDataGraph:
- Some useful data-relation information you can get from each ProDataRelationMetaData object for an output ProDataGraph is the specified data-relation name, parent table name, parent table index columns, child table name, and child table index columns, all specified according to a corresponding ProDataSet data-relation and accessible using these ProDataRelationMetaData methods:
For more information on ProDataRelationMetaData methods, see the "ProDataRelationMetaData class" section.
For more information on ProDataGraphMetaData methods, see the "ProDataGraphMetaData class" section.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |